/* API测试工具优化样式 */

/* 测试工具容器 */
.api-test-section {
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    border-radius: 12px;
    padding: 24px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
    border: 1px solid #e3e6ea;
}

.api-test-section h5 {
    color: #495057;
    font-weight: 600;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.api-test-section h5::before {
    content: "🧪";
    font-size: 1.2em;
}

/* 表单样式优化 */
.api-test-form {
    background: white;
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    border: 1px solid #dee2e6;
}

/* 表单组样式 */
.api-test-form .mb-3 {
    margin-bottom: 1.5rem;
}

/* 标签样式 */
.api-test-form .form-label {
    font-weight: 600;
    color: #374151;
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.9rem;
}

.api-test-form .form-label::before {
    content: "📝";
    font-size: 0.9em;
}

/* 输入框样式 */
.api-test-form .form-control {
    border: 2px solid #e5e7eb;
    border-radius: 8px;
    padding: 12px 16px;
    font-size: 0.9rem;
    transition: all 0.3s ease;
    background-color: #fafbfc;
}

.api-test-form .form-control:focus {
    border-color: #07C160;
    box-shadow: 0 0 0 3px rgba(7, 193, 96, 0.1);
    background-color: white;
    outline: none;
}

.api-test-form .form-control:hover {
    border-color: #d1d5db;
    background-color: white;
}

/* 文本域特殊样式 */
.api-test-form textarea.form-control {
    resize: vertical;
    min-height: 80px;
}

/* 提交按钮样式 */
.api-test-form .btn-primary {
    background: linear-gradient(135deg, #07C160 0%, #05a050 100%);
    border: none;
    border-radius: 8px;
    padding: 12px 24px;
    font-weight: 600;
    font-size: 0.9rem;
    transition: all 0.3s ease;
    box-shadow: 0 4px 12px rgba(7, 193, 96, 0.3);
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 140px;
    justify-content: center;
}

.api-test-form .btn-primary:hover {
    background: linear-gradient(135deg, #06a050 0%, #058a44 100%);
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(7, 193, 96, 0.4);
}

.api-test-form .btn-primary:active {
    transform: translateY(0);
    box-shadow: 0 2px 8px rgba(7, 193, 96, 0.3);
}

.api-test-form .btn-primary i {
    font-size: 1.1em;
}

/* 响应结果区域 */
.response-section {
    margin-top: 20px;
    background: white;
    border-radius: 8px;
    border: 1px solid #e5e7eb;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.response-section h6 {
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    margin: 0;
    padding: 12px 16px;
    font-weight: 600;
    color: #495057;
    border-bottom: 1px solid #e5e7eb;
    display: flex;
    align-items: center;
    gap: 8px;
}

.response-section h6::before {
    content: "📊";
    font-size: 1em;
}

.response-content {
    background: #1e293b;
    color: #e2e8f0;
    padding: 16px;
    margin: 0;
    font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
    font-size: 0.85rem;
    line-height: 1.5;
    white-space: pre-wrap;
    word-wrap: break-word;
    max-height: 300px;
    overflow-y: auto;
    border-radius: 0;
}

/* 响应内容滚动条样式 */
.response-content::-webkit-scrollbar {
    width: 8px;
}

.response-content::-webkit-scrollbar-track {
    background: #334155;
    border-radius: 4px;
}

.response-content::-webkit-scrollbar-thumb {
    background: #64748b;
    border-radius: 4px;
}

.response-content::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}

/* 加载状态样式 */
.api-test-form.loading .btn-primary {
    background: linear-gradient(135deg, #6c757d 0%, #5a6268 100%);
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.api-test-form.loading .btn-primary::after {
    content: "";
    width: 16px;
    height: 16px;
    border: 2px solid transparent;
    border-top: 2px solid white;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-left: 8px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* 成功/错误状态指示 */
.response-section.success .response-content {
    border-left: 4px solid #10b981;
}

.response-section.error .response-content {
    border-left: 4px solid #ef4444;
}

.response-section.success h6::before {
    content: "✅";
}

.response-section.error h6::before {
    content: "❌";
}

/* 参数提示样式 */
.form-text {
    font-size: 0.8rem;
    color: #6b7280;
    margin-top: 4px;
    display: flex;
    align-items: center;
    gap: 4px;
}

.form-text::before {
    content: "💡";
    font-size: 0.9em;
}

/* 必填字段标识 */
.form-label.required::after {
    content: " *";
    color: #ef4444;
    font-weight: bold;
}

/* 可选字段标识 */
.form-label.optional::after {
    content: " (可选)";
    color: #6b7280;
    font-weight: normal;
    font-size: 0.8em;
}

/* 响应式优化 */
@media (max-width: 768px) {
    .api-test-section {
        padding: 16px;
    }
    
    .api-test-form {
        padding: 16px;
    }
    
    .api-test-form .form-control {
        padding: 10px 12px;
    }
    
    .api-test-form .btn-primary {
        width: 100%;
        padding: 14px 20px;
    }
    
    .response-content {
        font-size: 0.8rem;
        max-height: 200px;
    }
}

/* 动画效果 */
.api-test-section {
    animation: fadeInUp 0.5s ease-out;
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* 表单验证样式 */
.form-control.is-invalid {
    border-color: #ef4444;
    box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.1);
}

.form-control.is-valid {
    border-color: #10b981;
    box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.1);
}

.invalid-feedback {
    color: #ef4444;
    font-size: 0.8rem;
    margin-top: 4px;
    display: flex;
    align-items: center;
    gap: 4px;
}

.invalid-feedback::before {
    content: "⚠️";
    font-size: 0.9em;
}

.valid-feedback {
    color: #10b981;
    font-size: 0.8rem;
    margin-top: 4px;
    display: flex;
    align-items: center;
    gap: 4px;
}

.valid-feedback::before {
    content: "✅";
    font-size: 0.9em;
}
